package com.example.wendao.model.db.dao;

import androidx.lifecycle.LiveData;
import androidx.paging.DataSource;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;


import com.example.wendao.model.entity.ForumPics;
import com.example.wendao.model.entity.News;

import java.util.List;

@Dao
public interface ForumPicsDao {
    //插入帖子图片
    @Insert
    void insertForumPic(ForumPics... forumpics);

    @Query("SELECT * FROM forumpics WHERE forumPicFatherId =:forumpicfatherid")//根据帖子id查询该贴图片
    DataSource.Factory<Integer, ForumPics> findForumPicsByFatherId(int forumpicfatherid);

    //根据帖子id查找封面
    @Query("SELECT * FROM forumpics WHERE forumPicFatherId =:forumpicfatherid AND forumPicPlace=0")
    ForumPics findForumPicsCoverByFatherId(int forumpicfatherid);

    //更新帖子图片
    @Update
    void updateForumPics(ForumPics... forumpics);
    //删除帖子图片
    @Delete
    void deleteForumPics(ForumPics... forumpics);
}
